package com.apestech.framework.sql.modul;

import java.util.ArrayList;

public class SqlList {
	
	private ArrayList<VarList> list=new ArrayList<VarList>();
	
	public void insertFirst(String text){
		ArrayList<VarList> plist=new ArrayList<VarList>(this.list);
		this.list=new ArrayList<VarList>();
		VarList v=new VarList();
		v.setText(text);
		this.list.add(v);
		int len=plist.size();
		for(int i=0; i<len; i++){
			this.list.add(plist.get(i));
		}
		plist=null;
	}
	
	public void insertFirst(VarList vlist){
		ArrayList<VarList> plist=new ArrayList<VarList>(this.list);
		this.list=new ArrayList<VarList>();
		this.list.add(vlist);
		int len=plist.size();
		for(int i=0; i<len; i++){
			this.list.add(plist.get(i));
		}
		plist=null;
	}
	
	public void insertFirst(SqlList vlist){
		int len=vlist.getList().size();
		for(int i=0; i<len; i++){
			insertFirst(vlist.get(i));
		}
	}
	
	public ArrayList<VarList> getList() {
		return list;
	}

	public void setList(ArrayList<VarList> list) {
		this.list = list;
	}

	public void add(String text){
 		VarList v=new VarList();
		v.setText(text);
		this.list.add(v);
	}
	
	public void add(VarList vlist){
		this.list.add(vlist);
	}
	
	public void add(SqlList vlist){
		int len=vlist.getList().size();
		for(int i=0; i<len; i++){
			add(vlist.get(i));
		}
	}

	public void addAll(int index, SqlList sqllist){
		this.list.addAll(index, sqllist.getList());
	}

	public void addAll(SqlList sqllist){
		this.list.addAll(sqllist.getList());
	}
	
	public VarList get(int index){
		return this.list.get(index);
	}
	
	public int size(){
		return this.list.size();
	}
	
	public String toString(){
		return list.toString();
	}

}
